package Thread;

/**
 * Created by pc on 4/12/16.
 */
import static java.lang.System.out;

public class JoinDemo {
    public static void main(String[] args) throws InterruptedException {
        out.println("Main thread starts...");

        Thread threadB = new Thread(() -> {
            out.println("ThreadB starts...");
            for (int i = 0; i < 5; i ++) {
                out.println("ThreadB is running");
            }
            out.println("ThreadB ends");
        }
        );

        threadB.start();
        //threadB.join();

        out.println("Main thread ends");
    }
}
